LAST_ARG
};
-static void gtk_text_tag_init (GtkTextTag *tkxt_tag);
+static void gtk_text_tag_init (GtkTextTag *text_tag);
static void gtk_text_tag_class_init (GtkTextTagClass *klass);
static void gtk_text_tag_destroy (GtkObject *object);
static void gtk_text_tag_finalize (GObject *object);
}
void
-gtk_text_tag_init (GtkTextTag *tkxt_tag)
+gtk_text_tag_init (GtkTextTag *text_tag)
{
/* 0 is basically a fine way to initialize everything in the
entire struct */
}
+/**
+ * gtk_text_tag_new:
+ * @name: tag name, or %NULL
+ *
+ * Creates a #GtkTextTag. Configure the tag using object arguments,
+ * i.e. using g_object_set().
+ *
+ * Return value: a new #GtkTextTag
+ **/
GtkTextTag*
gtk_text_tag_new (const gchar *name)
{
static void
gtk_text_tag_destroy (GtkObject *object)
{
- GtkTextTag *tkxt_tag;
+ GtkTextTag *text_tag;
- tkxt_tag = GTK_TEXT_TAG (object);
+ text_tag = GTK_TEXT_TAG (object);
- g_assert (!tkxt_tag->values->realized);
+ g_assert (!text_tag->values->realized);
- if (tkxt_tag->table)
- gtk_text_tag_table_remove (tkxt_tag->table, tkxt_tag);
+ if (text_tag->table)
+ gtk_text_tag_table_remove (text_tag->table, text_tag);
- g_assert (tkxt_tag->table == NULL);
+ g_assert (text_tag->table == NULL);
- gtk_text_attributes_unref (tkxt_tag->values);
- tkxt_tag->values = NULL;
+ gtk_text_attributes_unref (text_tag->values);
+ text_tag->values = NULL;
(* GTK_OBJECT_CLASS (parent_class)->destroy) (object);
}
static void
gtk_text_tag_finalize (GObject *object)
{
- GtkTextTag *tkxt_tag;
+ GtkTextTag *text_tag;
- tkxt_tag = GTK_TEXT_TAG (object);
+ text_tag = GTK_TEXT_TAG (object);
- g_free (tkxt_tag->name);
- tkxt_tag->name = NULL;
+ g_free (text_tag->name);
+ text_tag->name = NULL;
(* G_OBJECT_CLASS (parent_class)->finalize) (object);
}
static void
gtk_text_tag_set_arg (GtkObject *object, GtkArg *arg, guint arg_id)
{
- GtkTextTag *tkxt_tag;
+ GtkTextTag *text_tag;
gboolean size_changed = FALSE;
- tkxt_tag = GTK_TEXT_TAG (object);
+ text_tag = GTK_TEXT_TAG (object);
- g_return_if_fail (!tkxt_tag->values->realized);
+ g_return_if_fail (!text_tag->values->realized);
switch (arg_id)
{
case ARG_NAME:
- g_return_if_fail (tkxt_tag->name == NULL);
- tkxt_tag->name = g_strdup (GTK_VALUE_STRING (*arg));
+ g_return_if_fail (text_tag->name == NULL);
+ text_tag->name = g_strdup (GTK_VALUE_STRING (*arg));
break;
case ARG_BACKGROUND:
GdkColor color;
if (gdk_color_parse (GTK_VALUE_STRING (*arg), &color))
- set_bg_color (tkxt_tag, &color);
+ set_bg_color (text_tag, &color);
else
g_warning ("Don't know color `%s'", GTK_VALUE_STRING (*arg));
}
GdkColor color;
if (gdk_color_parse (GTK_VALUE_STRING (*arg), &color))
- set_fg_color (tkxt_tag, &color);
+ set_fg_color (text_tag, &color);
else
g_warning ("Don't know color `%s'", GTK_VALUE_STRING (*arg));
}
case ARG_BACKGROUND_GDK:
{
GdkColor *color = GTK_VALUE_POINTER (*arg);
- set_bg_color (tkxt_tag, color);
+ set_bg_color (text_tag, color);
}
break;
case ARG_FOREGROUND_GDK:
{
GdkColor *color = GTK_VALUE_POINTER (*arg);
- set_fg_color (tkxt_tag, color);
+ set_fg_color (text_tag, color);
}
break;
{
GdkBitmap *bitmap = GTK_VALUE_POINTER (*arg);
- tkxt_tag->bg_stipple_set = TRUE;
+ text_tag->bg_stipple_set = TRUE;
- if (tkxt_tag->values->appearance.bg_stipple != bitmap)
+ if (text_tag->values->appearance.bg_stipple != bitmap)
{
if (bitmap != NULL)
gdk_bitmap_ref (bitmap);
- if (tkxt_tag->values->appearance.bg_stipple)
- gdk_bitmap_unref (tkxt_tag->values->appearance.bg_stipple);
+ if (text_tag->values->appearance.bg_stipple)
+ gdk_bitmap_unref (text_tag->values->appearance.bg_stipple);
- tkxt_tag->values->appearance.bg_stipple = bitmap;
+ text_tag->values->appearance.bg_stipple = bitmap;
}
}
break;
{
GdkBitmap *bitmap = GTK_VALUE_POINTER (*arg);
- tkxt_tag->fg_stipple_set = TRUE;
+ text_tag->fg_stipple_set = TRUE;
- if (tkxt_tag->values->appearance.fg_stipple != bitmap)
+ if (text_tag->values->appearance.fg_stipple != bitmap)
{
if (bitmap != NULL)
gdk_bitmap_ref (bitmap);
- if (tkxt_tag->values->appearance.fg_stipple)
- gdk_bitmap_unref (tkxt_tag->values->appearance.fg_stipple);
+ if (text_tag->values->appearance.fg_stipple)
+ gdk_bitmap_unref (text_tag->values->appearance.fg_stipple);
- tkxt_tag->values->appearance.fg_stipple = bitmap;
+ text_tag->values->appearance.fg_stipple = bitmap;
}
}
break;
if (name)
font_desc = pango_font_description_from_string (name);
- if (tkxt_tag->values->font_desc)
- pango_font_description_free (tkxt_tag->values->font_desc);
+ if (text_tag->values->font_desc)
+ pango_font_description_free (text_tag->values->font_desc);
- tkxt_tag->font_set = (font_desc != NULL);
- tkxt_tag->values->font_desc = font_desc;
+ text_tag->font_set = (font_desc != NULL);
+ text_tag->values->font_desc = font_desc;
size_changed = TRUE;
}
font_desc = GTK_VALUE_BOXED (*arg);
- if (tkxt_tag->values->font_desc)
- pango_font_description_free (tkxt_tag->values->font_desc);
+ if (text_tag->values->font_desc)
+ pango_font_description_free (text_tag->values->font_desc);
if (font_desc)
- tkxt_tag->values->font_desc = pango_font_description_copy (font_desc);
+ text_tag->values->font_desc = pango_font_description_copy (font_desc);
else
- tkxt_tag->values->font_desc = NULL;
+ text_tag->values->font_desc = NULL;
- tkxt_tag->font_set = (font_desc != NULL);
+ text_tag->font_set = (font_desc != NULL);
size_changed = TRUE;
}
break;
case ARG_PIXELS_ABOVE_LINES:
- tkxt_tag->pixels_above_lines_set = TRUE;
- tkxt_tag->values->pixels_above_lines = GTK_VALUE_INT (*arg);
+ text_tag->pixels_above_lines_set = TRUE;
+ text_tag->values->pixels_above_lines = GTK_VALUE_INT (*arg);
size_changed = TRUE;
break;
case ARG_PIXELS_BELOW_LINES:
- tkxt_tag->pixels_below_lines_set = TRUE;
- tkxt_tag->values->pixels_below_lines = GTK_VALUE_INT (*arg);
+ text_tag->pixels_below_lines_set = TRUE;
+ text_tag->values->pixels_below_lines = GTK_VALUE_INT (*arg);
size_changed = TRUE;
break;
case ARG_PIXELS_INSIDE_WRAP:
- tkxt_tag->pixels_inside_wrap_set = TRUE;
- tkxt_tag->values->pixels_inside_wrap = GTK_VALUE_INT (*arg);
+ text_tag->pixels_inside_wrap_set = TRUE;
+ text_tag->values->pixels_inside_wrap = GTK_VALUE_INT (*arg);
size_changed = TRUE;
break;
case ARG_EDITABLE:
- tkxt_tag->editable_set = TRUE;
- tkxt_tag->values->editable = GTK_VALUE_BOOL (*arg);
+ text_tag->editable_set = TRUE;
+ text_tag->values->editable = GTK_VALUE_BOOL (*arg);
break;
case ARG_WRAP_MODE:
- tkxt_tag->wrap_mode_set = TRUE;
- tkxt_tag->values->wrap_mode = GTK_VALUE_ENUM (*arg);
+ text_tag->wrap_mode_set = TRUE;
+ text_tag->values->wrap_mode = GTK_VALUE_ENUM (*arg);
size_changed = TRUE;
break;
case ARG_JUSTIFY:
- tkxt_tag->justify_set = TRUE;
- tkxt_tag->values->justify = GTK_VALUE_ENUM (*arg);
+ text_tag->justify_set = TRUE;
+ text_tag->values->justify = GTK_VALUE_ENUM (*arg);
size_changed = TRUE;
break;
case ARG_DIRECTION:
- tkxt_tag->values->direction = GTK_VALUE_ENUM (*arg);
+ text_tag->values->direction = GTK_VALUE_ENUM (*arg);
break;
case ARG_LEFT_MARGIN:
- tkxt_tag->left_margin_set = TRUE;
- tkxt_tag->values->left_margin = GTK_VALUE_INT (*arg);
+ text_tag->left_margin_set = TRUE;
+ text_tag->values->left_margin = GTK_VALUE_INT (*arg);
size_changed = TRUE;
break;
case ARG_LEFT_WRAPPED_LINE_MARGIN:
- tkxt_tag->left_wrapped_line_margin_set = TRUE;
- tkxt_tag->values->left_wrapped_line_margin = GTK_VALUE_INT (*arg);
+ text_tag->left_wrapped_line_margin_set = TRUE;
+ text_tag->values->left_wrapped_line_margin = GTK_VALUE_INT (*arg);
size_changed = TRUE;
break;
case ARG_STRIKETHROUGH:
- tkxt_tag->strikethrough_set = TRUE;
- tkxt_tag->values->appearance.strikethrough = GTK_VALUE_BOOL (*arg);
+ text_tag->strikethrough_set = TRUE;
+ text_tag->values->appearance.strikethrough = GTK_VALUE_BOOL (*arg);
break;
case ARG_RIGHT_MARGIN:
- tkxt_tag->right_margin_set = TRUE;
- tkxt_tag->values->right_margin = GTK_VALUE_INT (*arg);
+ text_tag->right_margin_set = TRUE;
+ text_tag->values->right_margin = GTK_VALUE_INT (*arg);
size_changed = TRUE;
break;
case ARG_UNDERLINE:
- tkxt_tag->underline_set = TRUE;
- tkxt_tag->values->appearance.underline = GTK_VALUE_ENUM (*arg);
+ text_tag->underline_set = TRUE;
+ text_tag->values->appearance.underline = GTK_VALUE_ENUM (*arg);
break;
case ARG_OFFSET:
- tkxt_tag->offset_set = TRUE;
- tkxt_tag->values->offset = GTK_VALUE_INT (*arg);
+ text_tag->offset_set = TRUE;
+ text_tag->values->offset = GTK_VALUE_INT (*arg);
size_changed = TRUE;
break;
case ARG_BG_FULL_HEIGHT:
- tkxt_tag->bg_full_height_set = TRUE;
- tkxt_tag->values->bg_full_height = GTK_VALUE_BOOL (*arg);
+ text_tag->bg_full_height_set = TRUE;
+ text_tag->values->bg_full_height = GTK_VALUE_BOOL (*arg);
break;
case ARG_LANGUAGE:
- tkxt_tag->language_set = TRUE;
- tkxt_tag->values->language = g_strdup (GTK_VALUE_STRING (*arg));
+ text_tag->language_set = TRUE;
+ text_tag->values->language = g_strdup (GTK_VALUE_STRING (*arg));
break;
case ARG_TABS:
- tkxt_tag->tabs_set = TRUE;
+ text_tag->tabs_set = TRUE;
- if (tkxt_tag->values->tabs)
- pango_tab_array_free (tkxt_tag->values->tabs);
+ if (text_tag->values->tabs)
+ pango_tab_array_free (text_tag->values->tabs);
- tkxt_tag->values->tabs =
+ text_tag->values->tabs =
pango_tab_array_copy (GTK_VALUE_POINTER (*arg));
size_changed = TRUE;
case ARG_BACKGROUND_SET:
case ARG_BACKGROUND_GDK_SET:
- tkxt_tag->bg_color_set = GTK_VALUE_BOOL (*arg);
+ text_tag->bg_color_set = GTK_VALUE_BOOL (*arg);
break;
case ARG_FOREGROUND_SET:
case ARG_FOREGROUND_GDK_SET:
- tkxt_tag->fg_color_set = GTK_VALUE_BOOL (*arg);
+ text_tag->fg_color_set = GTK_VALUE_BOOL (*arg);
break;
case ARG_BACKGROUND_STIPPLE_SET:
- tkxt_tag->bg_stipple_set = GTK_VALUE_BOOL (*arg);
+ text_tag->bg_stipple_set = GTK_VALUE_BOOL (*arg);
break;
case ARG_FOREGROUND_STIPPLE_SET:
- tkxt_tag->fg_stipple_set = GTK_VALUE_BOOL (*arg);
+ text_tag->fg_stipple_set = GTK_VALUE_BOOL (*arg);
break;
case ARG_FONT_SET:
- tkxt_tag->font_set = GTK_VALUE_BOOL (*arg);
+ text_tag->font_set = GTK_VALUE_BOOL (*arg);
size_changed = TRUE;
break;
case ARG_PIXELS_ABOVE_LINES_SET:
- tkxt_tag->pixels_above_lines_set = GTK_VALUE_BOOL (*arg);
+ text_tag->pixels_above_lines_set = GTK_VALUE_BOOL (*arg);
size_changed = TRUE;
break;
case ARG_PIXELS_BELOW_LINES_SET:
- tkxt_tag->pixels_below_lines_set = GTK_VALUE_BOOL (*arg);
+ text_tag->pixels_below_lines_set = GTK_VALUE_BOOL (*arg);
size_changed = TRUE;
break;
case ARG_PIXELS_INSIDE_WRAP_SET:
- tkxt_tag->pixels_inside_wrap_set = GTK_VALUE_BOOL (*arg);
+ text_tag->pixels_inside_wrap_set = GTK_VALUE_BOOL (*arg);
size_changed = TRUE;
break;
case ARG_EDITABLE_SET:
- tkxt_tag->editable_set = GTK_VALUE_BOOL (*arg);
+ text_tag->editable_set = GTK_VALUE_BOOL (*arg);
break;
case ARG_WRAP_MODE_SET:
- tkxt_tag->wrap_mode_set = GTK_VALUE_BOOL (*arg);
+ text_tag->wrap_mode_set = GTK_VALUE_BOOL (*arg);
size_changed = TRUE;
break;
case ARG_JUSTIFY_SET:
- tkxt_tag->justify_set = GTK_VALUE_BOOL (*arg);
+ text_tag->justify_set = GTK_VALUE_BOOL (*arg);
size_changed = TRUE;
break;
case ARG_LEFT_MARGIN_SET:
- tkxt_tag->left_margin_set = GTK_VALUE_BOOL (*arg);
+ text_tag->left_margin_set = GTK_VALUE_BOOL (*arg);
size_changed = TRUE;
break;
case ARG_LEFT_WRAPPED_LINE_MARGIN_SET:
- tkxt_tag->left_wrapped_line_margin_set = GTK_VALUE_BOOL (*arg);
+ text_tag->left_wrapped_line_margin_set = GTK_VALUE_BOOL (*arg);
size_changed = TRUE;
break;
case ARG_STRIKETHROUGH_SET:
- tkxt_tag->strikethrough_set = GTK_VALUE_BOOL (*arg);
+ text_tag->strikethrough_set = GTK_VALUE_BOOL (*arg);
break;
case ARG_RIGHT_MARGIN_SET:
- tkxt_tag->right_margin_set = GTK_VALUE_BOOL (*arg);
+ text_tag->right_margin_set = GTK_VALUE_BOOL (*arg);
size_changed = TRUE;
break;
case ARG_UNDERLINE_SET:
- tkxt_tag->underline_set = GTK_VALUE_BOOL (*arg);
+ text_tag->underline_set = GTK_VALUE_BOOL (*arg);
break;
case ARG_OFFSET_SET:
- tkxt_tag->offset_set = GTK_VALUE_BOOL (*arg);
+ text_tag->offset_set = GTK_VALUE_BOOL (*arg);
size_changed = TRUE;
break;
case ARG_BG_FULL_HEIGHT_SET:
- tkxt_tag->bg_full_height_set = GTK_VALUE_BOOL (*arg);
+ text_tag->bg_full_height_set = GTK_VALUE_BOOL (*arg);
break;
case ARG_LANGUAGE_SET:
- tkxt_tag->language_set = GTK_VALUE_BOOL (*arg);
+ text_tag->language_set = GTK_VALUE_BOOL (*arg);
size_changed = TRUE;
break;
case ARG_TABS_SET:
- tkxt_tag->tabs_set = GTK_VALUE_BOOL (*arg);
+ text_tag->tabs_set = GTK_VALUE_BOOL (*arg);
size_changed = TRUE;
break;
/* This is also somewhat weird since we emit another object's
signal here, but the two objects are already tightly bound. */
- if (tkxt_tag->table)
- gtk_signal_emit_by_name (GTK_OBJECT (tkxt_tag->table),
+ if (text_tag->table)
+ gtk_signal_emit_by_name (GTK_OBJECT (text_tag->table),
"tag_changed",
- tkxt_tag, size_changed);
+ text_tag, size_changed);
}
static void
tag->priority += dd->delta;
}
+/**
+ * gtk_text_tag_get_priority:
+ * @tag: a #GtkTextTag
+ *
+ * Get the tag priority.
+ *
+ * Return value: The tag's priority.
+ **/
gint
gtk_text_tag_get_priority (GtkTextTag *tag)
{
return tag->priority;
}
+/**
+ * gtk_text_tag_set_priority:
+ * @tag: a #GtkTextTag
+ * @priority: the new priority
+ *
+ * Sets the priority of a #GtkTextTag. Valid priorities are
+ * start at 0 and go to one less than gtk_text_tag_table_size().
+ * Each tag in a table has a unique priority; setting the priority
+ * of one tag shifts the priorities of all the other tags in the
+ * table to maintain a unique priority for each tag. Higher priority
+ * tags "win" if two tags both set the same text attribute. When adding
+ * a tag to a tag table, it will be assigned the highest priority in
+ * the table by default; so normally the precedence of a set of tags
+ * is the order in which they were added to the table, or created with
+ * gtk_text_buffer_create_tag(), which adds the tag to the buffer's table
+ * automatically.
+ **/
void
gtk_text_tag_set_priority (GtkTextTag *tag,
gint priority)
tag->priority = priority;
}
+/**
+ * gtk_text_tag_event:
+ * @tag: a #GtkTextTag
+ * @event_object: object that received the event, such as a widget
+ * @event: the event
+ * @iter: location where the event was received
+ *
+ * Emits the "event" signal on the #GtkTextTag.
+ *
+ * Return value: result of signal emission (whether the event was handled)
+ **/
gint
-gtk_text_tag_event (GtkTextTag *tag,
- GtkObject *event_object,
- GdkEvent *event,
+gtk_text_tag_event (GtkTextTag *tag,
+ GObject *event_object,
+ GdkEvent *event,
const GtkTextIter *iter)
{
gint retval = FALSE;
* Attributes
*/
+/**
+ * gtk_text_attributes_new:
+ *
+ * Creates a #GtkTextAttributes, which describes
+ * a set of properties on some text.
+ *
+ * Return value: a new #GtkTextAttributes
+ **/
GtkTextAttributes*
gtk_text_attributes_new (void)
{
return values;
}
+/* FIXME change the signature of this to be correct */
void
gtk_text_attributes_copy (GtkTextAttributes *src,
GtkTextAttributes *dest)
* Modified by the GTK+ Team and others 1997-2000. See the AUTHORS
* file for a list of people on the GTK+ Team. See the ChangeLog
* files for a list of changes. These files are distributed with
- * GTK+ at ftp://ftp.gtk.org/pub/gtk/.
+ * GTK+ at ftp://ftp.gtk.org/pub/gtk/.
*/
#include <string.h>
text_view->drag_start_y = -1;
}
+/**
+ * gtk_text_view_new:
+ * Creates a new #GtkTextView. If you don't call gtk_text_view_set_buffer()
+ * before using the text view, an empty default buffer will be created
+ * for you. Get the buffer with gtk_text_view_get_buffer(). If you want
+ * to specify your own buffer, consider gtk_text_view_new_with_buffer().
+ *
+ * Return value: a new #GtkTextView
+ **/
GtkWidget*
gtk_text_view_new (void)
{
return GTK_WIDGET (gtk_type_new (gtk_text_view_get_type ()));
}
+/**
+ * gtk_text_view_new_with_buffer:
+ * @buffer: a #GtkTextBuffer
+ *
+ * Creates a new #GtkTextView widget displaying the buffer
+ * @buffer. One buffer can be shared among many widgets.
+ * @buffer may be NULL to create a default buffer, in which case
+ * this function is equivalent to gtk_text_view_new(). The
+ * text view adds its own reference count to the buffer; it does not
+ * take over an existing reference.
+ *
+ * Return value: a new #GtkTextView.
+ **/
GtkWidget*
gtk_text_view_new_with_buffer (GtkTextBuffer *buffer)
{
return GTK_WIDGET (text_view);
}
+/**
+ * gtk_text_view_set_buffer:
+ * @text_view: a #GtkTextView
+ * @buffer: a #GtkTextBuffer
+ *
+ * Sets @buffer as the buffer being displayed by @text_view. The previous
+ * buffer displayed by the text view is unreferenced, and a reference is
+ * added to @buffer. If you owned a reference to @buffer before passing it
+ * to this function, you must remove that reference yourself; #GtkTextView
+ * will not "adopt" it.
+ *
+ **/
void
gtk_text_view_set_buffer (GtkTextView *text_view,
GtkTextBuffer *buffer)
gtk_widget_queue_draw (GTK_WIDGET (text_view));
}
+static GtkTextBuffer*
+get_buffer (GtkTextView *text_view)
+{
+ if (text_view->buffer == NULL)
+ {
+ GtkTextBuffer *b;
+ b = gtk_text_buffer_new (NULL);
+ gtk_text_view_set_buffer (text_view, b);
+ g_object_unref (G_OBJECT (b));
+ }
+
+ return text_view->buffer;
+}
+
+/**
+ * gtk_text_view_get_buffer:
+ * @text_view: a #GtkTextView
+ *
+ * Returns the #GtkTextBuffer being displayed by this text view.
+ * The reference count on the buffer is not incremented; the caller
+ * of this function won't own a new reference.
+ *
+ * Return value: a #GtkTextBuffer
+ **/
GtkTextBuffer*
gtk_text_view_get_buffer (GtkTextView *text_view)
{
g_return_val_if_fail (GTK_IS_TEXT_VIEW (text_view), NULL);
- return text_view->buffer;
+ return get_buffer (text_view);
}
+/**
+ * gtk_text_view_get_iter_at_location:
+ * @text_view: a #GtkTextView
+ * @iter: a #GtkTextIter
+ * @x: x position, in buffer coordinates
+ * @y: y position, in buffer coordinates
+ *
+ * Retrieves the iterator at buffer coordinates @x and @y. Buffer
+ * coordinates are coordinates for the entire buffer, not just the
+ * currently-displayed portion. If you have coordinates from an
+ * event, you have to convert those to buffer coordinates with
+ * gtk_text_view_window_to_buffer_coords().
+ *
+ **/
void
gtk_text_view_get_iter_at_location (GtkTextView *text_view,
GtkTextIter *iter,
- gint x, gint y)
+ gint x,
+ gint y)
{
g_return_if_fail (GTK_IS_TEXT_VIEW (text_view));
g_return_if_fail (iter != NULL);
y);
}
+/**
+ * gtk_text_view_get_iter_location:
+ * @text_view: a #GtkTextView
+ * @iter: a #GtkTextIter
+ * @location: bounds of the character at @iter
+ *
+ * Returns a rectangle which roughly contains the character at @iter.
+ * The rectangle position is in buffer coordinates; use
+ * gtk_text_view_buffer_to_window_coords() to convert these
+ * coordinates to coordinates for one of the windows in the text view.
+ *
+ **/
void
gtk_text_view_get_iter_location (GtkTextView *text_view,
const GtkTextIter *iter,
GdkRectangle *location)
{
g_return_if_fail (GTK_IS_TEXT_VIEW (text_view));
- g_return_if_fail (gtk_text_iter_get_buffer (iter) == text_view->buffer);
+ g_return_if_fail (gtk_text_iter_get_buffer (iter) == get_buffer (text_view));
gtk_text_layout_get_iter_location (text_view->layout, iter, location);
}
+/**
+ * gtk_text_view_get_line_yrange:
+ * @text_view: a #GtkTextView
+ * @iter: a #GtkTextIter
+ * @y: return location for a y coordinate
+ * @height: return location for a height
+ *
+ * Returns the y coordinate of the top of the line containing @iter,
+ * and the height of the line. The coordinate is a buffer coordinate;
+ * convert to window coordinates with gtk_text_view_buffer_to_window_coords().
+ *
+ **/
void
gtk_text_view_get_line_yrange (GtkTextView *text_view,
const GtkTextIter *iter,
gint *height)
{
g_return_if_fail (GTK_IS_TEXT_VIEW (text_view));
- g_return_if_fail (gtk_text_iter_get_buffer (iter) == text_view->buffer);
+ g_return_if_fail (gtk_text_iter_get_buffer (iter) == get_buffer (text_view));
gtk_text_layout_get_line_yrange (text_view->layout,
iter,
height);
}
+/**
+ * gtk_text_view_get_line_at_y:
+ * @text_view: a #GtkTextView
+ * @target_iter: a #GtkTextIter
+ * @y: a y coordinate
+ * @line_top: return location for top coordinate of the line
+ *
+ * Returns the #GtkTextIter at the start of the line containing
+ * the coordinate @y. @y is in buffer coordinates, convert from
+ * window coordinates with gtk_text_view_window_to_buffer_coords().
+ * If non-%NULL, @line_top will be filled with the coordinate of the top
+ * edge of the line.
+ **/
void
gtk_text_view_get_line_at_y (GtkTextView *text_view,
GtkTextIter *target_iter,
return FALSE;
}
- gtk_text_buffer_get_iter_at_mark (text_view->buffer, &iter, mark);
+ gtk_text_buffer_get_iter_at_mark (get_buffer (text_view), &iter, mark);
gtk_text_layout_get_iter_location (text_view->layout,
&iter,
return retval;
}
+/**
+ * gtk_text_view_scroll_to_mark:
+ * @text_view: a #GtkTextView
+ * @mark: a #GtkTextMark
+ * @mark_within_margin: a margin
+ *
+ * Scrolls @text_view so that @mark is on the screen. If
+ * @mark_within_margin is nonzero, the mark will be moved onscreen by
+ * that many pixels. For example, if @mark_within_margin is 5, the
+ * mark will be at least 5 pixels away from the edge of the screen,
+ * if possible.
+ *
+ * Return value: TRUE if scrolling occurred
+ **/
gboolean
gtk_text_view_scroll_to_mark (GtkTextView *text_view,
GtkTextMark *mark,
visible_rect.y + visible_rect.height);
}
+/**
+ * gtk_text_view_move_mark_onscreen:
+ * @text_view: a #GtkTextView
+ * @mark: a #GtkTextMark
+ *
+ * Moves a mark within the buffer so that it's
+ * located within the currently-visible text area.
+ *
+ * Return value: %TRUE if scrolling occurred
+ **/
gboolean
gtk_text_view_move_mark_onscreen (GtkTextView *text_view,
GtkTextMark *mark)
g_return_val_if_fail (GTK_IS_TEXT_VIEW (text_view), FALSE);
g_return_val_if_fail (mark != NULL, FALSE);
- gtk_text_buffer_get_iter_at_mark (text_view->buffer, &iter, mark);
+ gtk_text_buffer_get_iter_at_mark (get_buffer (text_view), &iter, mark);
if (clamp_iter_onscreen (text_view, &iter))
{
- gtk_text_buffer_move_mark (text_view->buffer, mark, &iter);
+ gtk_text_buffer_move_mark (get_buffer (text_view), mark, &iter);
return TRUE;
}
else
return FALSE;
}
+/**
+ * gtk_text_view_get_visible_rect:
+ * @text_view: a #GtkTextView
+ * @visible_rect: rectangle to fill
+ *
+ * Fills @visible_rect with the currently-visible
+ * region of the buffer, in buffer coordinates. Convert to window coordinates
+ * with gtk_text_view_buffer_to_window_coords().
+ **/
void
gtk_text_view_get_visible_rect (GtkTextView *text_view,
GdkRectangle *visible_rect)
}
}
+/**
+ * gtk_text_view_set_wrap_mode:
+ * @text_view: a #GtkTextView
+ * @wrap_mode: a #GtkWrapMode
+ *
+ * Sets the line wrapping for the view.
+ **/
void
gtk_text_view_set_wrap_mode (GtkTextView *text_view,
GtkWrapMode wrap_mode)
}
}
+/**
+ * gtk_text_view_get_wrap_mode:
+ * @text_view: a #GtkTextView
+ *
+ * Gets the line wrapping for the view.
+ *
+ * Return value: the line wrap setting
+ **/
GtkWrapMode
gtk_text_view_get_wrap_mode (GtkTextView *text_view)
{
return text_view->wrap_mode;
}
+/**
+ * gtk_text_view_set_editable:
+ * @text_view: a #GtkTextView
+ * @setting: whether it's editable
+ *
+ * Sets the default editability of the #GtkTextView. You can override
+ * this default setting with tags in the buffer, using the "editable"
+ * attribute of tags.
+ **/
void
gtk_text_view_set_editable (GtkTextView *text_view,
gboolean setting)
}
}
+/**
+ * gtk_text_view_get_editable:
+ * @text_view: a #GtkTextView
+ *
+ * Returns the default editability of the #GtkTextView. Tags in the
+ * buffer may override this setting for some ranges of text.
+ *
+ * Return value: whether text is editable by default
+ **/
gboolean
gtk_text_view_get_editable (GtkTextView *text_view)
{
return text_view->editable;
}
+/**
+ * gtk_text_view_set_cursor_visible:
+ * @text_view: a #GtkTextView
+ * @setting: whether to show the insertion cursor
+ *
+ * Toggles whether the insertion point is displayed. A buffer with no editable
+ * text probably shouldn't have a visible cursor, so you may want to turn
+ * the cursor off.
+ **/
void
gtk_text_view_set_cursor_visible (GtkTextView *text_view,
gboolean setting)
}
}
+/**
+ * gtk_text_view_get_cursor_visible:
+ * @text_view: a #GtkTextView
+ *
+ * Find out whether the cursor is being displayed.
+ *
+ * Return value: whether the insertion mark is visible
+ **/
gboolean
gtk_text_view_get_cursor_visible (GtkTextView *text_view)
{
}
+/**
+ * gtk_text_view_place_cursor_onscreen:
+ * @text_view: a #GtkTextView
+ *
+ * Moves the cursor to the currently visible region of the
+ * buffer, it it isn't there already.
+ *
+ * Return value: TRUE if the cursor had to be moved.
+ **/
gboolean
gtk_text_view_place_cursor_onscreen (GtkTextView *text_view)
{
g_return_val_if_fail (GTK_IS_TEXT_VIEW (text_view), FALSE);
- gtk_text_buffer_get_iter_at_mark (text_view->buffer, &insert,
- gtk_text_buffer_get_mark (text_view->buffer,
+ gtk_text_buffer_get_iter_at_mark (get_buffer (text_view), &insert,
+ gtk_text_buffer_get_mark (get_buffer (text_view),
"insert"));
if (clamp_iter_onscreen (text_view, &insert))
{
- gtk_text_buffer_place_cursor (text_view->buffer, &insert);
+ gtk_text_buffer_place_cursor (get_buffer (text_view), &insert);
return TRUE;
}
else
text_view = GTK_TEXT_VIEW (object);
+ g_return_if_fail (text_view->buffer == NULL);
+
if (text_view->hadjustment)
gtk_object_unref (GTK_OBJECT (text_view->hadjustment));
if (text_view->vadjustment)
* children.
*/
GtkTextIter child_loc;
- gtk_text_buffer_get_iter_at_child_anchor (text_view->buffer,
+ gtk_text_buffer_get_iter_at_child_anchor (get_buffer (text_view),
&child_loc,
child->anchor);
gtk_text_view_get_first_para_iter (GtkTextView *text_view,
GtkTextIter *iter)
{
- gtk_text_buffer_get_iter_at_mark (text_view->buffer, iter,
+ gtk_text_buffer_get_iter_at_mark (get_buffer (text_view), iter,
text_view->first_para_mark);
}
text_view = GTK_TEXT_VIEW (widget);
- tags = gtk_text_buffer_get_tags (text_view->buffer, iter);
+ tags = gtk_text_buffer_get_tags (get_buffer (text_view), iter);
tmp = tags;
while (tmp != NULL)
text_view = GTK_TEXT_VIEW (widget);
if (text_view->layout == NULL ||
- text_view->buffer == NULL)
+ get_buffer (text_view) == NULL)
return FALSE;
if (event->any.window != text_view->text_window->bin_window)
GtkTextMark *insert;
GtkTextIter iter;
- insert = gtk_text_buffer_get_mark (text_view->buffer,
+ insert = gtk_text_buffer_get_mark (get_buffer (text_view),
"insert");
- gtk_text_buffer_get_iter_at_mark (text_view->buffer, &iter, insert);
+ gtk_text_buffer_get_iter_at_mark (get_buffer (text_view), &iter, insert);
return emit_event_on_tags (widget, event, &iter);
}
text_view = GTK_TEXT_VIEW (widget);
if (text_view->layout == NULL ||
- text_view->buffer == NULL)
+ get_buffer (text_view) == NULL)
return FALSE;
if (GTK_WIDGET_CLASS (parent_class)->key_press_event &&
return TRUE;
else if (event->keyval == GDK_Return)
{
- gtk_text_buffer_insert_interactive_at_cursor (text_view->buffer, "\n", 1,
+ gtk_text_buffer_insert_interactive_at_cursor (get_buffer (text_view), "\n", 1,
text_view->editable);
gtk_text_view_scroll_to_mark (text_view,
- gtk_text_buffer_get_mark (text_view->buffer,
+ gtk_text_buffer_get_mark (get_buffer (text_view),
"insert"),
0);
return TRUE;
/* Pass through Tab as literal tab, unless Control is held down */
else if (event->keyval == GDK_Tab && !(event->state & GDK_CONTROL_MASK))
{
- gtk_text_buffer_insert_interactive_at_cursor (text_view->buffer, "\t", 1,
+ gtk_text_buffer_insert_interactive_at_cursor (get_buffer (text_view), "\t", 1,
text_view->editable);
gtk_text_view_scroll_to_mark (text_view,
- gtk_text_buffer_get_mark (text_view->buffer,
+ gtk_text_buffer_get_mark (get_buffer (text_view),
"insert"),
0);
return TRUE;
event->x + text_view->xoffset,
event->y + text_view->yoffset);
- if (gtk_text_buffer_get_selection_bounds (text_view->buffer,
+ if (gtk_text_buffer_get_selection_bounds (get_buffer (text_view),
&start, &end) &&
gtk_text_iter_in_range (&iter, &start, &end))
{
event->x + text_view->xoffset,
event->y + text_view->yoffset);
- gtk_text_buffer_paste_primary (text_view->buffer,
+ gtk_text_buffer_paste_primary (get_buffer (text_view),
&iter,
text_view->editable);
return TRUE;
return;
}
- gtk_text_buffer_get_iter_at_mark (text_view->buffer, &insert,
- gtk_text_buffer_get_mark (text_view->buffer,
+ gtk_text_buffer_get_iter_at_mark (get_buffer (text_view), &insert,
+ gtk_text_buffer_get_mark (get_buffer (text_view),
"insert"));
newplace = insert;
case GTK_MOVEMENT_BUFFER_ENDS:
if (count > 0)
- gtk_text_buffer_get_last_iter (text_view->buffer, &newplace);
+ gtk_text_buffer_get_last_iter (get_buffer (text_view), &newplace);
else if (count < 0)
- gtk_text_buffer_get_iter_at_offset (text_view->buffer, &newplace, 0);
+ gtk_text_buffer_get_iter_at_offset (get_buffer (text_view), &newplace, 0);
break;
default:
if (!gtk_text_iter_equal (&insert, &newplace))
{
if (extend_selection)
- gtk_text_buffer_move_mark (text_view->buffer,
- gtk_text_buffer_get_mark (text_view->buffer,
+ gtk_text_buffer_move_mark (get_buffer (text_view),
+ gtk_text_buffer_get_mark (get_buffer (text_view),
"insert"),
&newplace);
else
- gtk_text_buffer_place_cursor (text_view->buffer, &newplace);
+ gtk_text_buffer_place_cursor (get_buffer (text_view), &newplace);
gtk_text_view_scroll_to_mark (text_view,
- gtk_text_buffer_get_mark (text_view->buffer,
+ gtk_text_buffer_get_mark (get_buffer (text_view),
"insert"), 0);
if (step == GTK_MOVEMENT_DISPLAY_LINES)
{
GtkTextIter insert;
- gtk_text_buffer_get_iter_at_mark (text_view->buffer, &insert,
- gtk_text_buffer_get_mark (text_view->buffer,
+ gtk_text_buffer_get_iter_at_mark (get_buffer (text_view), &insert,
+ gtk_text_buffer_get_mark (get_buffer (text_view),
"insert"));
- gtk_text_buffer_create_mark (text_view->buffer, "anchor", &insert, TRUE);
+ gtk_text_buffer_create_mark (get_buffer (text_view), "anchor", &insert, TRUE);
}
static void
gtk_text_layout_get_iter_at_pixel (text_view->layout, &new_insert, cursor_x_pos, cursor_y_pos);
clamp_iter_onscreen (text_view, &new_insert);
- gtk_text_buffer_place_cursor (text_view->buffer, &new_insert);
+ gtk_text_buffer_place_cursor (get_buffer (text_view), &new_insert);
gtk_text_view_set_virtual_cursor_pos (text_view, cursor_x_pos, cursor_y_pos);
* only guarantees 1 pixel onscreen.
*/
gtk_text_view_scroll_to_mark (text_view,
- gtk_text_buffer_get_mark (text_view->buffer,
+ gtk_text_buffer_get_mark (get_buffer (text_view),
"insert"),
0);
}
gtk_text_view_insert_at_cursor (GtkTextView *text_view,
const gchar *str)
{
- gtk_text_buffer_insert_interactive_at_cursor (text_view->buffer, str, -1,
+ gtk_text_buffer_insert_interactive_at_cursor (get_buffer (text_view), str, -1,
text_view->editable);
}
if (type == GTK_DELETE_CHARS)
{
/* Char delete deletes the selection, if one exists */
- if (gtk_text_buffer_delete_selection (text_view->buffer, TRUE,
+ if (gtk_text_buffer_delete_selection (get_buffer (text_view), TRUE,
text_view->editable))
return;
}
- gtk_text_buffer_get_iter_at_mark (text_view->buffer,
+ gtk_text_buffer_get_iter_at_mark (get_buffer (text_view),
&insert,
- gtk_text_buffer_get_mark (text_view->buffer,
+ gtk_text_buffer_get_mark (get_buffer (text_view),
"insert"));
start = insert;
if (!gtk_text_iter_equal (&start, &end))
{
- if (gtk_text_buffer_delete_interactive (text_view->buffer, &start, &end,
+ if (gtk_text_buffer_delete_interactive (get_buffer (text_view), &start, &end,
text_view->editable))
{
if (leave_one)
- gtk_text_buffer_insert_interactive_at_cursor (text_view->buffer,
+ gtk_text_buffer_insert_interactive_at_cursor (get_buffer (text_view),
" ", 1,
text_view->editable);
}
gtk_text_view_scroll_to_mark (text_view,
- gtk_text_buffer_get_mark (text_view->buffer, "insert"),
+ gtk_text_buffer_get_mark (get_buffer (text_view), "insert"),
0);
}
}
static void
gtk_text_view_cut_clipboard (GtkTextView *text_view)
{
- gtk_text_buffer_cut_clipboard (text_view->buffer, text_view->editable);
+ gtk_text_buffer_cut_clipboard (get_buffer (text_view), text_view->editable);
gtk_text_view_scroll_to_mark (text_view,
- gtk_text_buffer_get_mark (text_view->buffer,
+ gtk_text_buffer_get_mark (get_buffer (text_view),
"insert"),
0);
}
static void
gtk_text_view_copy_clipboard (GtkTextView *text_view)
{
- gtk_text_buffer_copy_clipboard (text_view->buffer);
+ gtk_text_buffer_copy_clipboard (get_buffer (text_view));
gtk_text_view_scroll_to_mark (text_view,
- gtk_text_buffer_get_mark (text_view->buffer,
+ gtk_text_buffer_get_mark (get_buffer (text_view),
"insert"),
0);
}
static void
gtk_text_view_paste_clipboard (GtkTextView *text_view)
{
- gtk_text_buffer_paste_clipboard (text_view->buffer, text_view->editable);
+ gtk_text_buffer_paste_clipboard (get_buffer (text_view), text_view->editable);
gtk_text_view_scroll_to_mark (text_view,
- gtk_text_buffer_get_mark (text_view->buffer,
+ gtk_text_buffer_get_mark (get_buffer (text_view),
"insert"),
0);
}
{
GtkTextIter insert;
- gtk_text_buffer_get_iter_at_mark (text_view->buffer,
+ gtk_text_buffer_get_iter_at_mark (get_buffer (text_view),
&insert,
- gtk_text_buffer_get_mark (text_view->buffer,
+ gtk_text_buffer_get_mark (get_buffer (text_view),
"insert"));
- gtk_text_buffer_move_mark (text_view->buffer,
- gtk_text_buffer_get_mark (text_view->buffer,
+ gtk_text_buffer_move_mark (get_buffer (text_view),
+ gtk_text_buffer_get_mark (get_buffer (text_view),
"selection_bound"),
&insert);
}
{
gboolean scrolled = FALSE;
GtkTextMark *insert_mark =
- gtk_text_buffer_get_mark (text_view->buffer, "insert");
+ gtk_text_buffer_get_mark (get_buffer (text_view), "insert");
- gtk_text_buffer_move_mark (text_view->buffer,
+ gtk_text_buffer_move_mark (get_buffer (text_view),
insert_mark,
&newplace);
newplace = *iter;
- gtk_text_buffer_place_cursor (text_view->buffer, &newplace);
+ gtk_text_buffer_place_cursor (get_buffer (text_view), &newplace);
text_view->selection_drag_handler = gtk_signal_connect (GTK_OBJECT (text_view),
"motion_notify_event",
GTK_SIGNAL_FUNC (changed_handler),
text_view);
- if (text_view->buffer)
- gtk_text_layout_set_buffer (text_view->layout, text_view->buffer);
+ if (get_buffer (text_view))
+ gtk_text_layout_set_buffer (text_view->layout, get_buffer (text_view));
if ((GTK_WIDGET_HAS_FOCUS (text_view) && text_view->cursor_visible))
gtk_text_view_start_cursor_blink (text_view);
str = NULL;
length = 0;
- if (gtk_text_buffer_get_selection_bounds (text_view->buffer, &start, &end))
+ if (gtk_text_buffer_get_selection_bounds (get_buffer (text_view), &start, &end))
{
/* Extract the selected text */
str = gtk_text_iter_get_visible_text (&start, &end);
&newplace,
bx, by);
- if (gtk_text_buffer_get_selection_bounds (text_view->buffer,
+ if (gtk_text_buffer_get_selection_bounds (get_buffer (text_view),
&start, &end) &&
gtk_text_iter_in_range (&newplace, &start, &end))
{
}
}
- gtk_text_buffer_move_mark (text_view->buffer,
- gtk_text_buffer_get_mark (text_view->buffer,
+ gtk_text_buffer_move_mark (get_buffer (text_view),
+ gtk_text_buffer_get_mark (get_buffer (text_view),
"gtk_drag_target"),
&newplace);
margin /= 5;
gtk_text_view_scroll_to_mark_adjusted (text_view,
- gtk_text_buffer_get_mark (text_view->buffer,
+ gtk_text_buffer_get_mark (get_buffer (text_view),
"gtk_drag_target"),
margin, 1.0);
}
text_view = GTK_TEXT_VIEW (widget);
- drag_target_mark = gtk_text_buffer_get_mark (text_view->buffer,
+ drag_target_mark = gtk_text_buffer_get_mark (get_buffer (text_view),
"gtk_drag_target");
if (drag_target_mark == NULL)
return;
- gtk_text_buffer_get_iter_at_mark (text_view->buffer,
+ gtk_text_buffer_get_iter_at_mark (get_buffer (text_view),
&drop_point,
drag_target_mark);
if (str)
{
- gtk_text_buffer_insert_interactive (text_view->buffer,
+ gtk_text_buffer_insert_interactive (get_buffer (text_view),
&drop_point, str, -1,
text_view->editable);
g_free (str);
{
gtk_text_layout_get_line_at_y (text_view->layout, &iter, adj->value, &line_top);
- gtk_text_buffer_move_mark (text_view->buffer, text_view->first_para_mark, &iter);
+ gtk_text_buffer_move_mark (get_buffer (text_view), text_view->first_para_mark, &iter);
text_view->first_para_pixels = adj->value - line_top;
}
const gchar *str,
GtkTextView *text_view)
{
- gtk_text_buffer_delete_selection (text_view->buffer, TRUE,
+ gtk_text_buffer_delete_selection (get_buffer (text_view), TRUE,
text_view->editable);
if (!strcmp (str, "\n"))
{
- gtk_text_buffer_insert_interactive_at_cursor (text_view->buffer, "\n", 1,
+ gtk_text_buffer_insert_interactive_at_cursor (get_buffer (text_view), "\n", 1,
text_view->editable);
}
else
{
if (text_view->overwrite_mode)
gtk_text_view_delete_from_cursor (text_view, GTK_DELETE_CHARS, 1);
- gtk_text_buffer_insert_interactive_at_cursor (text_view->buffer, str, -1,
+ gtk_text_buffer_insert_interactive_at_cursor (get_buffer (text_view), str, -1,
text_view->editable);
}
gtk_text_view_scroll_to_mark (text_view,
- gtk_text_buffer_get_mark (text_view->buffer,
+ gtk_text_buffer_get_mark (get_buffer (text_view),
"insert"),
0);
}
GdkRectangle strong_pos;
GtkTextIter insert;
- gtk_text_buffer_get_iter_at_mark (text_view->buffer, &insert,
- gtk_text_buffer_get_mark (text_view->buffer,
+ gtk_text_buffer_get_iter_at_mark (get_buffer (text_view), &insert,
+ gtk_text_buffer_get_mark (get_buffer (text_view),
"insert"));
if ((x && text_view->virtual_cursor_x == -1) ||
GdkRectangle strong_pos;
GtkTextIter insert;
- gtk_text_buffer_get_iter_at_mark (text_view->buffer, &insert,
- gtk_text_buffer_get_mark (text_view->buffer,
+ gtk_text_buffer_get_iter_at_mark (get_buffer (text_view), &insert,
+ gtk_text_buffer_get_mark (get_buffer (text_view),
"insert"));
if (x == -1 || y == -1)
/* Windows */
+/**
+ * gtk_text_view_get_window:
+ * @text_view: a #GtkTextView
+ * @win: window to get
+ *
+ * Retrieves the #GdkWindow corresponding to an area of the text view;
+ * possible windows include the overall widget window, child windows
+ * on the left, right, top, bottom, and the window that displays the
+ * text buffer. Windows are %NULL and nonexistent if their width or
+ * height is 0, and are nonexistent before the widget has been
+ * realized.
+ *
+ * Return value: a #GdkWindow, or %NULL
+ **/
GdkWindow*
gtk_text_view_get_window (GtkTextView *text_view,
GtkTextWindowType win)
}
}
+/**
+ * gtk_text_view_get_window_type:
+ * @text_view: a #GtkTextView
+ * @window: a window type
+ *
+ * Usually used to find out which window an event corresponds to.
+ * If you connect to an event signal on @text_view, this function
+ * should be called on <literal>event->window</literal> to
+ * see which window it was.
+ *
+ * Return value: the window type.
+ **/
GtkTextWindowType
gtk_text_view_get_window_type (GtkTextView *text_view,
GdkWindow *window)
return win->type;
else
{
- g_warning ("%s: Window is not a text view window",
- G_STRLOC);
- return 0;
+ return GTK_TEXT_WINDOW_PRIVATE;
}
}
if (win == NULL)
{
g_warning ("Attempt to convert text buffer coordinates to coordinates "
- "for a nonexistent child window of GtkTextView");
+ "for a nonexistent or private child window of GtkTextView");
return;
}
window_y);
}
+/**
+ * gtk_text_view_buffer_to_window_coords:
+ * @text_view: a #GtkTextView
+ * @win: a #GtkTextWindowType
+ * @buffer_x: buffer x coordinate
+ * @buffer_y: buffer y coordinate
+ * @window_x: window x coordinate return location
+ * @window_y: window y coordinate return location
+ *
+ * Converts coordinate (@buffer_x, @buffer_y) to coordinates for the window
+ * @win, and stores the result in (@window_x, @window_y).
+ **/
void
gtk_text_view_buffer_to_window_coords (GtkTextView *text_view,
GtkTextWindowType win,
window_x, window_y);
break;
+ case GTK_TEXT_WINDOW_PRIVATE:
+ g_warning ("%s: can't get coords for private windows", G_STRLOC);
+ break;
+
default:
g_warning ("%s: Unknown GtkTextWindowType", G_STRLOC);
break;
buffer_y);
}
+/**
+ * gtk_text_view_window_to_buffer_coords:
+ * @text_view: a #GtkTextView
+ * @win: a #GtkTextWindowType
+ * @window_x: window x coordinate
+ * @window_y: window y coordinate
+ * @buffer_x: buffer x coordinate return location
+ * @buffer_y: buffer y coordinate return location
+ *
+ * Converts coordinates on the window identified by @win to buffer
+ * coordinates, storing the result in (@buffer_x,@buffer_y).
+ **/
void
gtk_text_view_window_to_buffer_coords (GtkTextView *text_view,
GtkTextWindowType win,
buffer_x, buffer_y);
break;
+ case GTK_TEXT_WINDOW_PRIVATE:
+ g_warning ("%s: can't get coords for private windows", G_STRLOC);
+ break;
+
default:
g_warning ("%s: Unknown GtkTextWindowType", G_STRLOC);
break;
}
}
+/**
+ * gtk_text_view_set_border_window_size:
+ * @text_view: a #GtkTextView
+ * @type: window to affect
+ * @size: width or height of the window
+ *
+ * Sets the width of %GTK_TEXT_WINDOW_LEFT or %GTK_TEXT_WINDOW_RIGHT,
+ * or the height of %GTK_TEXT_WINDOW_TOP or %GTK_TEXT_WINDOW_BOTTOM.
+ * Automatically destroys the corresponding window if the size is set to 0,
+ * and creates the window if the size is set to non-zero.
+ **/
void
gtk_text_view_set_border_window_size (GtkTextView *text_view,
GtkTextWindowType type,
break;
default:
- g_warning ("Unknown GtkTextWindowType in %s", G_STRLOC);
+ g_warning ("Can't set size of center or widget or private GtkTextWindowType in %s", G_STRLOC);
break;
}
}
+/**
+ * gtk_text_view_set_text_window_size:
+ * @text_view: a #GtkTextView
+ * @width: a width in pixels
+ * @height: a height in pixels
+ *
+ * Sets the size request for the main text window (%GTK_TEXT_WINDOW_TEXT).
+ * If the widget gets more space than it requested, the main text window
+ * will be larger than this.
+ *
+ **/
void
gtk_text_view_set_text_window_size (GtkTextView *text_view,
gint width,